# frozen_string_literal: true

class CreateFormulas < ActiveRecord::Migration[6.0]
  def change
    create_table :formulas do |t|
      t.string  :formulable_type, null: false,  limit: 64
      t.integer :formulable_id,   null: false,  limit: 8
      t.string  :type,            null: false,  limit: 64
      t.text    :content,         null: false,  limit: 0xfff
      t.timestamps                null: false
    end

    add_index :formulas, %i[formulable_type formulable_id], unique: true
  end
end
